package com.vegetable.modules.entity.outbound;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.vegetable.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 销售订货
 * </p>
 *
 * @author wangruijie
 * @since 2024-03-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="SalesOrder对象", description="销售订货")
public class SalesOrder extends BaseEntity {

    @ApiModelProperty(value = "生产者ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long producerId;

    @ApiModelProperty(value = "订单时间（走货时间）")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date orderTime;

    @ApiModelProperty(value = "采购时间（备货时间）")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date purchaseTime;

    @ApiModelProperty(value = "状态0未确认，1已确认 2已发货，3已完成")
    private Integer state;

    @ApiModelProperty(value = "首次下达")
    @TableField(exist = false)
    private Integer isFirst;

    @ApiModelProperty(value = "是否确认下达0否，1是")
    @TableField(exist = false)
    private Integer isTransmit;

    @ApiModelProperty(value = "文档编号")
    private String docNo;

    @ApiModelProperty(value = "客户id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long customerId;

    @ApiModelProperty(value = "客户名称")
    private String customerName;

    @ApiModelProperty(value = "客户别名")
    private String customerNameAlias;

    @ApiModelProperty(value = "数量")
    private Integer number;

    @ApiModelProperty(value = "重量")
    private BigDecimal weight;

    @ApiModelProperty(value = "描述")
    private String remark;

    @ApiModelProperty(value = "创建者ID")
    private Long createUserId;

    @ApiModelProperty(value = "创建人")
    @TableField(exist = false)
    private String createUserName;

    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date createTime;

    @ApiModelProperty(value = "商品明细")
    @TableField(exist = false)
    private List<SalesOrderDetail> commodities;

    @ApiModelProperty(value = "是否全部走货完成")
    @TableField(exist = false)
    private Integer isAllShift;
    @ApiModelProperty(value = "是否全部走货完成")
    @TableField(exist = false)
    private List<SalesOrderDetail> shiftInfo;

    @Version
    @ApiModelProperty(value = "版本號")
    private Integer version;

    @ApiModelProperty(value = "台账标识 0寿光 1河北")
    private Integer regionId;

}
